#include<stdio.h>
int main(){
	int m,n,yue,bei,sign;
	scanf("%d %d",&m,&n);
	int min=m<n?m:n;
	int max=m>n?m:n;
	for(sign=min;sign>0;sign--){
		if(m%sign==0&&n%sign==0){
			yue=sign;
			break;
		}
	}
	for(sign=max;;sign++){
		if(sign%m==0&&sign%n==0){
			bei=sign;
			break;
		}
	}
	printf("%d %d",yue,bei);
}
